package com.example.recruitment_website.controller;

import com.example.recruitment_website.domain.User;
import com.example.recruitment_website.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("Feedback")
public class FeedbackController {

    @Autowired
    FeedbackService feedbackService;

    @GetMapping("/addFeedback")
    public HashMap addFeedback(int userId, String title, String content){
        int state = feedbackService.addFeedBack(title,userId,content);
        HashMap<String,Object> map = new HashMap<>();
        if (state == 0){
            map.put("msg","反馈失败");
            map.put("code",0);
            return map;
        }

        map.put("msg","反馈成功");
        map.put("code",1);
        return map;
    }

}
